<template>
  <div>
    <h1>合同页面</h1>
    <p v-if="contractCreated">合同已创建。</p>
    <p v-if="contractCreated">租户姓名: {{ tenantName }}</p>
    <p v-if="contractCreated">房东姓名: {{ landlordName }}</p>
  </div>
</template>

<script>
import axios from 'axios';

export default {
  data() {
    return {
      contractCreated: false,
      tenantName: '',
      landlordName: ''
    };
  },
  created() {
    this.fetchContractDetails();
  },
  methods: {
    async fetchContractDetails() {
      try {
        const response = await axios.get('/api/contract/details');
        this.contractCreated = response.data.contractCreated;
        this.tenantName = response.data.tenantName;
        this.landlordName = response.data.landlordName;
      } catch (error) {
        console.error('获取合同详情失败:', error);
      }
    }
  }
};
</script>

<style>
/* Add styles here */
</style>
